// 清除指定页面组件缓存
// 针对的是keep-alive包裹的页面组价
function removeCacheFn(node, name) {
    console.log(node);
    if (!node.$vnode) return;
    if (node.$vnode.parent) {
        handleRemoveCacheFn(node, name)
    } else {
        if (node.$vnode.componentOptions.tag !== 'App') {
            removeCacheFn(node.$parent, name)
        } else {
            return;
        }
    }
}
function handleRemoveCacheFn(that, name) {
    if (!(that.$vnode && that.$vnode.parent)) return;
    let keepAlive = that.$vnode.parent;
    let cache = keepAlive.componentInstance.cache;
    let keys = keepAlive.componentInstance.keys;
    let delKey = '';
    for (const i in cache) {
        if (Object.hasOwnProperty.call(cache, i)) {
            if (cache[i].name === name) {
                delKey = cache[i].tag.split('-')[2]
                let index = keys.indexOf(delKey);
                if (index > -1) {
                    keys.splice(index, 1)
                }
                cache[i] = null;
            }
        }
    }
}
export default {
    removeCacheFn
}